1. Field of the Invention
The present invention relates generally to the creation of computer generated images for viewing on a screen. In particular, the present invention relates to the shading of computer generated images.
2. Art Background
The rendering and display of non-uniform surfaces such as curves and rough surfaces has long been a problem in three-dimensional computer graphics systems. The difficulty in performing these tasks is a result of the polygonal nature of these systems. For reasons of speed and diversity, most three-dimensional objects to be displayed in computer systems are represented by a collection of flat polygons. A polygonal system such as this has the advantage of being able to translate and project such objects quickly and efficiently. A chief drawback of polygon modeling, however, is the difficulty in representing complex surfaces as a collection of flat polygons. A smooth curve, for example, would require an infinite number of flat polygons to be accurately represented. Even the subdivision of the curve into a finite polygon mesh might still lead to unacceptable visual inaccuracies depending on the distance and angle it is being viewed from. Many different strategies have been proposed for the rendering of such surfaces within the confines of polygonal data representation.
Techniques known as Gouraud shading and Phong shading are previous approaches to the rendering of curved surfaces specified by flat polygons. Both of these techniques work in a similar fashion wherein the polygonal data is not altered, but the illusion of curvature across the drawn surface of a particular polygon is achieved by the individual illumination of every pixel within its visible surface. Gouraud shading, or color interpolation, is the fastest of these techniques and, consequently, the most widely used in real-time applications. In Gouraud shading, the particular curve of a polygon is specified by a collection of normalized three-dimensional vectors representing to the surface angle of the polygon at each of its vertices. Light intensity values are calculated at each vertex by taking the dot product of the vertex angle vector and the various light source vectors. The intensity values at each vertex are then linearly interpolated across the drawn surface of the polygon. This variance of light intensity gives the rough impression of a curved surface.
However, Gouraud shading has several drawbacks. The highlights produced by a Gouraud shading model are linear (angular), which can produce visual inaccuracies in polygons representing too great a curvature. Another shortcoming of Gouraud shading is its inability to reliably display specular highlights. Since the highlights produced by specular reflected light are generally smaller than diffuse highlights, those specular highlights which occur at or near the center of a polygon could be missed entirely by Gouraud shading. According to one improvement of the Gouraud shading technique, the polygon is tessellated in accordance with its curvature and its relation to given light sources. This process, however, is still subject to the same limitations generally imposed by Gouraud shading.
Another shading technique is known as Phong shading. This technique works by interpolating the vertex angle vectors across the drawn surface of the polygon and then carrying out lighting equations for every pixel therein. The highlights produced by this technique are quadratic (round) and, because lighting calculations are done per pixel, all specular highlights are accurately displayed. The chief drawback of a Phong shading model is the severe performance penalty imposed by the amount of per pixel calculation required. Accordingly, the computational burden associated with this process is significant.
Some attempts have been made to reduce the computational cost of pure Phong shading by selectively shading polygons: using more complex shading routines only on polygons which require them. This process is illustrated in U.S. Pat. No. 5,253,339. While the use of such a technique to reduces the overall time required for scene generation, polygons representing significant curvature must still be shaded with complex, time-consuming lighting routines.
Therefore, as described above, there is a need for a method and apparatus capable of producing a high quality three-dimensional image using a computationally more efficient process.